package com.bmw.accesscount.controller;

import com.bmw.accesscount.service.ROrderService;
import com.bmw.accesscount.service.RankService;
import com.bmw.accesscount.util.bean.BaseResponse;
import com.bmw.accesscount.util.bean.OrderReq;
import com.bmw.accesscount.util.bean.RankResp;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.util.List;

/**
 * Classname: RankController
 * Package: com.bmw.accesscount.controller
 * Description:
 *
 * @Author 余集楠
 * @Create 2024/6/12 0012 21:07
 * @Version 1.8
 */
@RestController
@RequestMapping(value="/rank")
@Slf4j
public class RankController {
    @Autowired
    RankService rankService;

    @Autowired
    ROrderService rOrderService;

    @RequestMapping(value="/list")
    public BaseResponse<List<RankResp>>list(){
        return BaseResponse.OK(rankService.list1());
    }

    @RequestMapping(value="/order")
    public BaseResponse order(@Valid @RequestBody OrderReq orderReq){
        return BaseResponse.ok(rOrderService.order(orderReq));
    }
}
